package xujoe.cyjl.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import xujoe.cyjl.pojo.Idiom;
import xujoe.cyjl.service.AdminService;

import javax.annotation.Resource;
import java.util.ArrayList;

@Controller
public class main {
    @Resource
    public AdminService adminService;

    @RequestMapping(value = "getNext.do", produces = "application/json; charset=utf-8")
    @ResponseBody
    public Object getNext(String nowWord) {
        if (nowWord.trim().equals("")) {
            return -1;
        } else {
            ArrayList<Idiom> result = adminService.getNext(nowWord.trim());
            return result;
        }
    }




    @RequestMapping(value = "getIdiom_n.do", produces = "application/json; charset=utf-8")
    @ResponseBody
    public Object getIdiom_n() {
        int allIdiom_n = adminService.getAllIdiom_n();
        return allIdiom_n;
    }

}
